package com.xuetang9.t9.hotel.mapper;

import com.xuetang9.t9.hotel.beans.ETakeoutFood;
import com.xuetang9.t9.hotel.mapper.sql.impl.TakeoutOrderSql;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Classname ETakeoutFoodMapper
 * @Description TODO
 * @Date 2020/3/6 16:10
 * @Created by ASUS
 */
public interface ETakeoutFoodMapper {
    @Insert("insert into e_takeoutfood values (#{id},#{foodId},#{count})")
    int insertFood(ETakeoutFood food);

    @Delete("delete from e_takeoutfood where id = #{id}")
    int removeFood(@Param("id") Long id);

    @Select("select * from e_takeoutfood where id = #{id}")
    @Results({
            @Result(id = true ,column = "foodId",property = "foodId"),
            @Result(column = "foodId",property = "food",one = @One(select = "com.xuetang9.t9.hotel.mapper.EFoodMapper.queryById"))
    })
    List<ETakeoutFood> queryById(@Param("id") Long id);


}
